#pragma strict

var arrow:Transform;
var left_arrow_pos:Vector3[];
var right_arrow_pos:Vector3[];

private var chosen_option:int;
private var max_options:int;
private var left_arrow:Transform;
private var right_arrow:Transform;

function Start () {
	chosen_option = 0;
	max_options = 2;
	left_arrow = Instantiate(arrow, left_arrow_pos[chosen_option], Quaternion.identity);
	right_arrow = Instantiate(arrow, right_arrow_pos[chosen_option], Quaternion.identity);
	right_arrow.localScale.x *= -1;
}

function Update () {	
	if (Input.GetButton("Enter")) {
		if (chosen_option == 0) { // start
			Application.LoadLevel("InstructionScene");
		}
		else if (chosen_option == 1) { // credits
			Application.LoadLevel("CreditsScene");
		}
	}
	else if (Input.GetButton("Up")) {
		chosen_option--;
		if (chosen_option <= 0) chosen_option = 0;
		left_arrow.transform.position = left_arrow_pos[chosen_option];
		right_arrow.transform.position = right_arrow_pos[chosen_option];
	}
	else if (Input.GetButton("Down")) {
		chosen_option++;
		if (chosen_option >= max_options) chosen_option = max_options - 1;
		left_arrow.transform.position = left_arrow_pos[chosen_option];
		right_arrow.transform.position = right_arrow_pos[chosen_option];
	}
	else if (Input.GetButton("StartEditor")) {		
		Application.LoadLevel("CustomLevelScene");
	}
}

function OnGUI() {
	/*GUILayout.BeginArea(Rect(0,0,Screen.width, Screen.height));
		GUILayout.BeginVertical("box");
			if (GUILayout.Button("Start Game")) {
				Application.LoadLevel("GameScene");
			}
			if (GUILayout.Button("Credits")) {
				Application.LoadLevel("Credits");
			}
		GUILayout.EndVertical();
	GUILayout.EndArea();*/
}